import java.util.Scanner;

/**
 * @Author 12629
 * @Description:
 */
public class Test {

	public static void main(String[] args) {
		// 模拟三次密码输入，最多输入三次；密码正确提示登录成功，密码错误可重新输入最多三次，三次均错提示退出程序
		Scanner scanner = new Scanner(System.in);
		int i = 3;
		while (i > 0) {
			System.out.print("请输入密码：");
			String password = scanner.nextLine();
			if (password.equals("12345")) {
				System.out.println("登陆成功");
				break;
			} else {
				i--;
				System.out.println("密码错误，还有" + i + "次机会");
			}
		}
		if (i == 0) {
			System.out.println("密码错误三次，退出程序");
		}
	}


	/*public static void main(String[] args) {
		// 获取一个数二进制序列中所有的偶数位和奇数位，分别输出二进制序列
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNext()) {
			int num = scanner.nextInt();
			System.out.print("奇数位：");
			for (int i = 31; i >= 0; i -= 2) {
				System.out.print(((num >>> i) & 1) + " ");
			}
			System.out.println();
			System.out.print("偶数位：");
			for (int i = 30; i >= 0; i -= 2) {
				System.out.print(((num >>> i) & 1) + " ");
			}
			System.out.println();
		}
	}*/

	/*public static void main(String[] args) {
		// 返回参数二进制中1的个数
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int num = scanner.nextInt();
			int sum = 0;
			if (num >= 0) {
				while (num > 1) {
					int i = 1;
					while (num > i) {
						i *= 2;
					}
					if (num == i) {
						num = num - i;
					} else {
						num = num - i / 2;
					}
					sum++;
				}
			} else {
				sum++;
				num = -num;
				while (num > 1) {
					int i = 1;
					while (num > i) {
						i *= 2;
					}
					if (num == i) {
						num = num - i;
					} else {
						num = num - i / 2;
					}
					sum++;
				}
			}
			if (num == 1) {
				sum++;
			}
			System.out.println("有" + sum + "个1");
		}
	}*/

	/*public static void main(String[] args) {
		// 100-999的水仙花数
		int nar = 100;
		int sum = 0;
		while (nar < 1000) {
			int i = nar / 100;// 百位
			int j = (nar % 100) / 10;// 十位
			int k = nar % 100 % 10;// 个位
			if (Math.pow(i, 3) + Math.pow(k, 3) + Math.pow(j, 3) == nar) {
				System.out.print(nar + " ");
				sum++;
			}
			nar++;
		}
		System.out.println("共有" + sum + "个水仙花数");
	}
*/

	/*public static void main(String[] args) {
		// 计算1/1-1/2+1/3……+1/99-1/100
		int i = 1;
		double sum = 0;
		int flg = 1;
		while (i <= 100) {
			sum = sum + 1.0 / i * flg;
			i++;
			flg = -flg;
		}
		System.out.println(sum);
	}*/


	/*public static void main(String[] args) {
		// 两个正整数的最大公约数
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			if (a < b) {
				int c = a;
				a = b;
				b = c;
			}
			int c = a % b;
			while (c != 0) {
				a = b;
				b = c;
				c = a % b;
			}
			System.out.println("最大公约数为" + b);
		}
	}*/

	/*public static void main(String[] args) {
		// 输出乘法口诀表
		int i = 1;
		int mul = 0;
		while (i < 10) {
			int j = 1;
			while (j <= i) {
				mul = i * j;
				System.out.print(j + " * " + i + " = " + mul + "  ");
				if (mul < 10) {
					System.out.print(" ");
				}
				if (i == j) {
					System.out.println();
				}
				j++;
			}
			i++;
		}
	}*/

	/*public static void main(String[] args) {
		// 1000-2000之间的闰年
		int year = 1000;
		int i = 0;
		int sum = 0;
		while (year <= 2000) {
			if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
				System.out.print(year + " ");
				i++;
				sum++;
			}
			if (i == 10) {
				System.out.println();
				i = 0;
			}
			year++;
		}
		System.out.println("有" + sum + "个闰年");
	}*/

	/*public static void main(String[] args) {
		// 打印1-100之间的所有素数
		int num = 1;
		int sum = 0;
		while (num <= 100) {
			int i = 1;
			int j = num / 2;
			while (i <= j) {
				if (i * j < num) {
					i++;
				} else if (i * j > num) {
					j--;
				} else {
					break;
				}
			}
			if (i > j && num != 1) {
				System.out.print(num + " ");
				sum++;
			}
			num++;
		}
		System.out.println("总共有" + sum + "个素数");
	}*/

	/*public static void main(String[] args) {
		// 判断一个数是不是素数
		Scanner scanner = new Scanner(System.in);
		while (true) {
			System.out.print("这个数是否为素数：");
			int num = scanner.nextInt();
			int i = 1;
			int j = num / 2;
			while (i <= j) {
				if (i * j < num) {
					i++;
				} else if (i * j > num) {
					j--;
				} else {
					System.out.println("不是素数");
					break;
				}
			}
			if (i > j && num != 1) {
				System.out.println("是素数");
			}
			if (num == 1) {
				System.out.println("不是素数");
			}
		}
	}*/

	/*public static void main(String[] args) {
		// 年龄打印，少年-18，青年19-28，中年29-55，老年56-
		Scanner scanner = new Scanner(System.in);
		while (true) {
			System.out.print("请输入年龄：");
			int age = scanner.nextInt();
			if (age <= 18) {
				System.out.println("少年");
			} else if (age > 18 && age <= 28) {
				System.out.println("青年");
			} else if (age > 28 && age <= 55) {
				System.out.println("中年");
			} else {
				System.out.println("老年");
			}
		}
	}*/

	/*public static void main3(String[] args) {
		// 猜数字
		// 自动生成随机整数（1-100），用户输入猜测数字，若小于随机数提示低了，若大于随机数提示高了，若相等提示猜对了
		// 生成随机数
		Random random = new Random();
		int randNum = random.nextInt(101);//[0-101)
		System.out.println("随机数：" + randNum);

		Scanner scanner = new Scanner(System.in);
		while (true) {
			System.out.println("请输入数字：");
			int num = scanner.nextInt();
			if (num < randNum) {
				System.out.println("低了");
			} else if (num > randNum) {
				System.out.println("高了");
			} else {
				System.out.println("猜对了");
				break;
			}
		}

	}*/


	/*public static void main2(String[] args) {
		for (int i = 0; i < 10; i++) {
			System.out.println(i);
		}
	}*/


	/*public static void main1(String[] args) {

		// 1-100 既能被3、5整除
		int i = 1;
		while (i <= 100) {
			if (i % 3 == 0 && i % 5 == 0) {
				System.out.println(i);
				i++;
				continue;
			}
			i++;
		}


		// Scanner scanner = new Scanner(System.in);
		// int year = scanner.nextInt();// 输入


		// short a = 128;
		// byte b = (byte) a;
		// System.out.println(a);
		// System.out.println(b);



		*//*System.out.println(10 % 3);// 1
		System.out.println(-10 % 3);//-1
		System.out.println(10 % -3);//-1//1
		System.out.println(-10 % -3);// 1//-1*//*

		// System.out.println(11.5 % 2);
		// System.out.println(10 / 0);


		// int a = 10;
		// a = a++;
		// System.out.println(a);
		// System.out.println(5 < a);


		*//*System.out.println(5 / 2);// 2
		System.out.println((float) 5 / 2);// 2.5
		System.out.println(5 / (float) 2);// 2.5
		System.out.println((float) (5 / 2));// 2.0*//*


	 *//*System.out.println("hello");
        int a = 10;
        System.out.println(a);

        char b = 'A';
        char c = '张';
        System.out.println(b);
        System.out.println(c);*//*
	}*/
}
